// This file contain some small javascript functions
// require for Open Cafe to work.

// Following function is used in sidebar nav menu
$(document).ready(function() {
  //$('div.sidenav:eq(0)> div.subnav').hide();
  $('div.sidenav:eq(0)> div.navhead').click(function() {
	$(this).next().slideToggle('fast');
  });
});

function initEditor(el){
	CKEDITOR.replace(el,{
		resize_enabled: true,
		language:   "vi",
		height : 300,
		width:840,
		filebrowserBrowseUrl :      "http://"+window.location.host+'/public/ckeditor/ckfinder/ckfinder.html',
		filebrowserImageBrowseUrl : "http://"+window.location.host+'/public/ckeditor/ckfinder/ckfinder.html?Type=Images',
		filebrowserFlashBrowseUrl : "http://"+window.location.host+'/public/ckeditor/ckfinder/ckfinder.html?Type=Flash',
		filebrowserUploadUrl :      "http://"+window.location.host+'/public/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
		filebrowserImageUploadUrl : "http://"+window.location.host+'/public/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
		filebrowserFlashUploadUrl : "http://"+window.location.host+'/public/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash' 
	});
}
function initEditorBasic(el){
	CKEDITOR.replace(el,{
		resize_enabled: false,
		language:   "vi",
		toolbar:"Basic",
		height : 300,
		width:840,
		filebrowserBrowseUrl :      "http://"+window.location.host+'/public/ckeditor/ckfinder/ckfinder.html',
		filebrowserImageBrowseUrl : "http://"+window.location.host+'/public/ckeditor/ckfinder/ckfinder.html?Type=Images',
		filebrowserFlashBrowseUrl : "http://"+window.location.host+'/public/ckeditor/ckfinder/ckfinder.html?Type=Flash',
		filebrowserUploadUrl :      "http://"+window.location.host+'/public/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
		filebrowserImageUploadUrl : "http://"+window.location.host+'/public/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
		filebrowserFlashUploadUrl : "http://"+window.location.host+'/public/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash' 
	});
}